package com.aspose.cells.a.f;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.tools.zip.ZipFile;

class zg extends zd {
   private byte[] d;
   private File e;

   zg(InputStream var1) throws Exception {
      this.d = a(var1);
      this.f();
      this.e();
   }

   public void c() throws Exception {
      if (this.c != null) {
         this.c.close();
         this.c = null;
         this.e.delete();
         this.e = null;
      }

   }

   public boolean d() throws Exception {
      if (this.e == null) {
         this.f();
      }

      return true;
   }

   private void f() throws Exception {
      this.e = File.createTempFile("AsposeCells", ".zip");
      this.e.deleteOnExit();
      BufferedOutputStream var1 = new BufferedOutputStream(new FileOutputStream(this.e));
      var1.write(this.d);
      var1.close();
      this.c = new ZipFile(this.e);
   }

   private static byte[] a(InputStream var0) throws IOException {
      ByteArrayOutputStream var1 = new ByteArrayOutputStream();
      BufferedInputStream var2 = new BufferedInputStream(var0);
      byte[] var3 = new byte[1024];

      int var4;
      while((var4 = var2.read(var3)) > 0) {
         var1.write(var3, 0, var4);
      }

      return var1.toByteArray();
   }
}
